<?php

class WxModel extends Model {

    public function get_primary_key() {
        return $this->primary_key = 'id';
    }

	public function set_reply($id, $data) {
		$id = intval($id);
		
	    if ($id) {
	    	 $this->db->where('id',$id)->update('wx_reply', $data);
	        
	        return $id;
	    }
	    $this->db->insert('wx_reply', $data);
	    if ($this->get_insert_id()) return $this->get_insert_id();
	    return false;
	}
	   
   public function get_welcome(){
   	$sql = "select *  from ".$this->prefix . "wx_reply where type = 4";
   	return $this->db->query($sql)->row_array();
   }  
   
    public function fget_insert_id(){
    	return $this->get_insert_id();
    }

    public function get_morepic_one($id){
    	$sql = "select * from ".$this->prefix . "wx_morepic where id = $id";
    	return $this->db->query($sql)->row_array();
    }
   
    public function get_content_list_by_morepic_id($morepic_id){
    	$sql = "select * from ".$this->prefix . "wx_content where morepic_id = $morepic_id order by id asc";
    	return $this->db->query($sql)->result_array();
    }
}